The functions described in this section allow you to specify various parameters for drawing operations, such as clipping, scaling, graphics mode, anddecompression quality. All of these functions are based on corresponding routines in the Image Compression Manager for working with image decompression sequences.
Defines the rectangle in which to draw an image.
extern pascal ComponentResult GraphicsImportSetBoundsRect (
GraphicsImportComponent ci,
const Rect *bounds);
ci Specifies the component instance that identifies your connection to the graphics importer component.
bounds A pointer to a rectangle structure describing the bounding rectangle into which the image will be drawn.
You use this function to define the rectangle into which the graphics image should be drawn. The function creates a transformation matrix to map the image's natural bounds to the specified bounds and then calls the GraphicsImportSetMatrix function.
Because this function affects the transformation matrix, you should use the GraphicsImportSetMatrix function [link] instead of this function when you also need to specify more complex transformations of the matrix.
noErr
|
0 | No error |
paramErr
|
-50 | Invalid parameter specified |
memFullErr
|
-108 | Not enough memory available |
Returns the bounding rectangle for drawing.
extern pascal ComponentResult GraphicsImportGetBoundsRect (
GraphicsImportComponent ci,
Rect *bounds);
ci Specifies the component instance that identifies your connection to the graphics importer component.
bounds A pointer to a rectangle structure describing the bounding rectangle that has been defined for the image.
This is a convenience function that is implemented by calling GraphicsImportGetMatrix [link] and GraphicsImportGetNaturalBounds [link] and using the results to calculate the drawing rectangle.
noErr
|
0 | No error |
paramErr
|
-50 | Invalid parameter specified |
memFullErr
|
-108 | Not enough memory available |
Defines the transformation matrix to use for drawing an image.
extern pascal ComponentResult GraphicsImportSetMatrix (
GraphicsImportComponent ci,
const MatrixRecord *matrix);
ci Specifies the component instance that identifies your connection to the graphics importer component.
matrix A pointer to a matrix structure that specifies how to transform the image during decompression. For example, you can use a transformation matrix to scale or rotate the image. To set the matrix to identity, pass nil in this parameter.
The GraphicsImportSetMatrix function establishes the transformation matrix to be applied to an image, which determines where and how it will be drawn.
This function affects the bounding rectangle defined for the image. You can specify where an image will be drawn by setting either a transformation matrix or a bounding rectangle, but it is usually more convenient for applications to set a bounding rectangle using the GraphicsImportSetBoundsRect [link] function.
noErr
|
0 | No error |
paramErr
|
-50 | Invalid parameter specified |
memFullErr
|
-108 | Not enough memory available |
For more information about transformation matrices and the functions for working with them, see the Movie Toolbox chapter of Inside Macintosh: QuickTime .
Returns the transformation matrix to be used for drawing.
extern pascal ComponentResult GraphicsImportGetMatrix (
GraphicsImportComponent ci,
MatrixRecord *matrix);
ci Specifies the component instance that identifies your connection to the graphics importer component.
matrix A pointer to the transformation matrix that has been defined for the image.
The transformation matrix is initialized to the identity matrix when the grapics importer component is instantiated.
noErr
|
0 | No error |
paramErr
|
-50 | Invalid parameter specified |
memFullErr
|
-108 | Not enough memory available |
Defines the clipping region for drawing.
extern pascal ComponentResult GraphicsImportSetClip (
GraphicsImportComponent ci,
RgnHandle clipRgn);
ci Specifies the component instance that identifies your connection to the graphics importer component.
clipRgn A handle to a clipping region in the destination coordinate system. Set to nil to disable clipping. The grapics importer component makes a copy of this region.
Because all drawing operations ignore the port clip, you must use this function to clip an image. The graphics importer component draws only that portion of the image that lies within the specified clipping region.
noErr
|
0 | No error |
paramErr
|
-50 | Invalid parameter specified |
memFullErr
|
-108 | Not enough memory available |
Returns the current clipping region.
extern pascal ComponentResult GraphicsImportGetClip (
GraphicsImportComponent ci,
RgnHandle *clipRgn);
ci Specifies the component instance that identifies your connection to the graphics importer component.
clipRgn A handle to the clipping region that has been defined for the image. Returns nil if there is no clipping region.
noErr
|
0 | No error |
paramErr
|
-50 | Invalid parameter specified |
memFullErr
|
-108 | Not enough memory available |
Sets the graphics transfer mode for an image.
extern pascal ComponentResult GraphicsImportSetGraphicsMode (
GraphicsImportComponent ci,
long graphicsMode,
const RGBColor *opColor);
ci Specifies the component instance that identifies your connection to the graphics importer component.
graphicsMode Specifies the graphics transfer mode to use for drawing the image. QuickTime supports the same graphics modes as Color QuickDraw's CopyBits function (described in Inside Macintosh: Imaging with QuickDraw ) as well as any mode defined by the Image Compression manager, such as alpha modes.
opColor A pointer to an RGB color structure describing the color to use for blending and transparent operations.
You can use this function to specify the graphics transfer mode and color to use for blending and transparent operations.
noErr
|
0 | No error |
paramErr
|
-50 | Invalid parameter specified |
memFullErr
|
-108 | Not enough memory available |
Returns the graphics transfer mode for an image.
extern pascal ComponentResult GraphicsImportGetGraphicsMode (
GraphicsImportComponent ci,
long *graphicsMode,
RGBColor *opColor);
ci Specifies the component instance that identifies your connection to the graphics importer component.
graphicsMode A pointer to a long integer. The function returns the QuickDraw graphics transfer mode setting for the image. Set to nil if you are not interested in this information.
opColor A pointer to an RGB color structure. The function returns the color currently specified for blend and transparent operations. Set to nil if you are not interested in this information.
You can use this function to find out the current graphics transfer mode and color to use for blending and transparent operations. The default graphics mode is ditherCopy and the default opColor is 50% gray.
noErr
|
0 | No error |
paramErr
|
-50 | Invalid parameter specified |
memFullErr
|
-108 | Not enough memory available |
extern pascal ComponentResult GraphicsImportSetQuality (
GraphicsImportComponent ci,
CodecQ quality);
ci Specifies the component instance that identifies your connection to the graphics importer component.
quality Specifies the desired image quality for decompression. Values for this parameter are on the same scale as compression quality. See page 3-57 of Inside Macintosh: QuickTime for a description of the defined quality constants.
The quality parameter controls how precisely the decompressor decompresses the image data. Some decompressors may choose to ignore some image data to improve decompression speed.
noErr
|
0 | No error |
paramErr
|
-50 | Invalid parameter specified |
memFullErr
|
-108 | Not enough memory available |
Returns the image quality value.
extern pascal ComponentResult GraphicsImportGetQuality (
GraphicsImportComponent ci,
CodecQ *quality);
ci Specifies the component instance that identifies your connection to the graphics importer component.
The quality value indicates how precisely the decompressor will decompress the image data. Some decompressors may choose to ignore some image data to improve decompression speed. With QuickTime 3 the default quality is codecHighQuality .
noErr
|
0 | No error |
paramErr
|
-50 | Invalid parameter specified |
memFullErr
|
-108 | Not enough memory available |
Sets the source rectangle to use for an image.
extern pascal ComponentResult GraphicsImportSetSourceRect (
GraphicsImportComponent ci,
const Rect *sourceRect);
ci Specifies the component instance that identifies your connection to the graphics importer component.
sourceRect A pointer to a rectangle defining the portion of the image to decompress. This rectangle must lie within the boundary rectangle of the source image. Set to nil to use the entire image.
This function provides a way to use only a portion of the source image. Set the sourceRect parameter to nil to specify that the entire image source rectangle should be used.
noErr
|
0 | No error |
paramErr
|
-50 | Invalid parameter specified |
memFullErr
|
-108 | Not enough memory available |
Returns the current source rectangle for an image.
extern pascal ComponentResult GraphicsImportGetSourceRect (
GraphicsImportComponent ci,
Rect *sourceRect);
ci Specifies the component instance that identifies your connection to the graphics importer component.
sourceRect A pointer to a rectangle structure. The function returns the source rectangle currently specified for the image.
This function returns the current source rectangle, as specified by the GraphicsImportSetSourceRect function. The default source rectangle is the image's natural bounds.
noErr
|
0 | No error |
paramErr
|
-50 | Invalid parameter specified |
memFullErr
|
-108 | Not enough memory available |
Installs a progress procedure to call while drawing an image.
extern pascal ComponentResult GraphicsImportSetProgressProc (
GraphicsImportComponent ci,
ICMProgressProcRecordPtr progressProc);
ci Specifies the component instance that identifies your connection to the graphics importer c omponent.
progressProc Points to a progress function structure. If you pass a value of -1, you obtain a standard progress function. If you want to remove the existing progress function, pass nil .
This function sets a progress function that will be installed in the image decompression sequence used to draw the image.
See Movie Toolbox: Application-Defined Functions for more information about progress functions.
If your progress function does any drawing, you should take care to set a safe graphics state before doing so, and to restore the graphics state afterwards. In particular, the current graphics device may be an offscreen device.
noErr
|
0 | No error |
paramErr
|
-50 | Invalid parameter specified |
memFullErr
|
-108 | Not enough memory available |
Returns the current progress procedure.
extern pascal ComponentResult GraphicsImportGetProgressProc (
GraphicsImportComponent ci,
ICMProgressProcRecordPtr progressProc);
ci Specifies the component instance that identifies your connection to the graphics importer component.
noErr
|
0 | No error |
paramErr
|
-50 | Invalid parameter specified |
memFullErr
|
-108 | Not enough memory available |
| Previous | Chapter Contents | Chapter Top | Next |